#include <iostream>
#include <vector>
using namespace std;

int minimumHeatersNeeded(int n, int r, const vector<int>& house) 
{
    int heatersNeeded = 0;
    int currentPos = 1; // Start from the beginning of the house.

    while (currentPos <= n) 
	{
        int bestHeater = -1; // Position of the best heater found for the current position.
        // Find the rightmost heater for the current position
        for (int i = max(1, currentPos - r + 1); i <= min(n, currentPos + r - 1); i++) 
		{
            if (house[i - 1] == 1 && i > bestHeater) 
			{
                bestHeater = i;
            }
        }

        if (bestHeater == -1) 
		{
            // No heater can warm the current position
            return -1;
        }

        heatersNeeded++;
        // Move the current position to the next position after the range of the best heater found
        currentPos = bestHeater + r;
    }

    return heatersNeeded;
}

int main() 
{
    int n, r;
    cin >> n >> r;

    vector<int> house(n);
    for (int i = 0; i < n; ++i) 
	{
        cin >> house[i];
    }

    cout << minimumHeatersNeeded(n, r, house) << endl;

    return 0;
}

